1. Field of the Invention
The present invention relates to an image processing apparatus, method and program for segmenting a character image described in a frame or a table in a document image, and a storage medium storing such a program.
2. Description of the Related Art
When reading characters described in a document, such as an application form or the like, in many cases, a document formed with a dropout color is used, and characters described with a color different from the dropout color are read and recognized. Since dropout-color documents are printed and distributed using a color adapted to conditions of a light source of a reading apparatus, the documents are expensive and inconvenient.
Although non-dropout-color documents are less expensive and convenient, it is impossible to discriminate between characters and closing lines. Accordingly, the following approaches have been considered as methods for recognizing a non-dropout-color document.
In a conventional method, the positions and the sizes of frames for describing characters within a document are stored in advance as a document definition, and described characters are extracted by reading differences between an input document to be read and the document definition by superposing them after correcting position deviation between the input document and the document definition. In this method, however, since it is necessary to store the document definition in advance, an input document other than the document definition cannot be dealt with. Accordingly, techniques have been considered in which, even if a document definition is not stored in advance, a frame for describing a character and a character within the frame are recognized.
For example, according to Japanese Patent Application Laid-Open (Kokai) No. 07-282191 (1995), a black run continuous for at least a predetermined length in the vertical and horizontal directions is extracted as a set of rules (i.e., lines). In some cases, a vertical rule and a horizontal rule are disconnected. In such a case, the vertical rule and the horizontal rule are virtually extended, and if the length of an extended portion is equal to or less than a threshold, the vertical line and the horizontal line are assumed to be connected, and the black run is recognized as a rectangular frame. However, since the frame is handled to be a straight rectangle, if a document having a round portion at a corner of a frame is recognized, the round corner portion is segmented as a character when extracting a character within the frame and is used in character recognition processing, and erroneous character recognition will sometimes occur.
In Japanese Patent Application Laid-Open (Kokai) No. 07-14000 (1995), a plurality of patterns of corners of a frame are stored in advance. Black pixels continuous in vertical and horizontal directions are checked, and black pixels continuous in the vertical and horizontal directions, having a length equal to or more than a predetermined value are determined to provide rules. A corner-portion pattern that is stored in advance is matched with a intersection point of a pair of a vertical rule and a horizontal rule whose end points are close to each other. If similarity is large, the corner portion is determined to correspond to that pattern. In this approach, it is necessary to store a large number of corner-portion patterns in advance, and therefore to provide a large memory capacity. In addition, a corner portion is not recognized if it has a pattern other than stored patterns.
In Japanese Patent Application Laid-Open (Kokai) No. 2000-235619 (2,000), a round corner portion is determined by identifying a pixel-density distribution in an oblique direction between end points of extracted rules, or by performing a matching operation by generating a pattern connecting end points of rules using an n-degree function. In the former approach, however, when a change in the pixel-density distribution is small, for example, when a thin portion is present in a corner portion, the corner portion is sometimes not recognized. In the latter approach, although a large number of round-corner portions need not be stored in advance, it is necessary to perform processing of generating a pattern using an n-degree function and matching processing, resulting in an increase in the processing time.
As described above, in the above-described conventional approaches, there are problems such that, for example, a large memory capacity is necessary, processing requiring a long time for matching or the like must be performed, accuracy in recognition is inferior, and a round portion of rules is segmented as a character and is erroneously recognized.